
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {$LOAD_STYLE.top|raw}
</head>
	<body class="pear-container">
		<div class="layui-card">
			<div class="layui-card-body">
				<form class="layui-form layui-form-pane" action="">
					<div class="layui-form-item">
                        
                        <div class="layui-form-item layui-inline">
                       <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="query">
                           <i class="layui-icon layui-icon-search"></i>
                           查询
                       </button>
                       <button type="reset" class="pear-btn pear-btn-md">
                           <i class="layui-icon layui-icon-refresh"></i>
                           重置
                       </button>
                       </div>
                    </div>
				</form>
			</div>
		</div>
		<div class="layui-card">
			<div class="layui-card-body">
				<table id="dataTable" lay-filter="dataTable"></table>
			</div>
		</div>
        
	    <script type="text/html" id="toolbar">
			<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="batchRecovery">
		        <i class="layui-icon layui-icon-refresh"></i>
		        恢复数据
			</button>
		    <button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
		        <i class="layui-icon layui-icon-delete"></i>
		        彻底删除
		    </button>
		</script>
        <script>
        layui.use(['jquery','common','mycomm','table'], function() {
            let $ = layui.jquery;
        	let common = layui.common;
        	let mycomm = layui.mycomm;
        	let table = layui.table;
            let MODULE_PATH = "{$MODULE_PATH}";
            let table_name = "dataTable";
            
            let cols = [
                [{
                      type: 'checkbox',
                    }, {
                       field: "id",
                       title: "ID",
                       width: 80,
                       unresize: "true",
                       hide:"true",
                       align: "center"
                    }, {
                       field: "create_time2",
                       title: "下单时间",
                       width: 100,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "pur_sn",
                       title: "订单号",
                       hide:true,
                       width: 150,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "store_name",
                       title: "门店",
                       hide:true,
                       width: 70,
                       unresize: "true",
                       align: "center"
                    }, {
                       field: "staff_name",
                       title: "销售",
                       width: 60,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "pur_kind",
                       title: "类型",
                       width: 60,
                       unresize: "true",
                       align: "center",
                       templet : "#pur_kind",
                    }, {
                       field: "fabric_code",
                       title: "编号",
                       width: 70,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "fabric_name",
                       title: "品名",
                       width: 150,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "color_code",
                       title: "色号",
                       width: 60,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "color_name",
                       title: "颜色",
                       width: 80,
                       unresize: "true",
                       align: "center",
                    }, {
                       field: "count",
                       title: "数量",
                       width: 80,
                       templet: "#count",
                       unresize: "true",
                       align: "center",
                       templet : "<div>{{d.count}} {{d.unit}}</div>",
                    }, {
                        field: "",
                        title: "",
                        width:  70,
                        hide:true,
                        unresize: "true",
                        align: "left",
                        templet:"#color_hex",
                    }, {
                        field: "sup_name",
                        title: "供应商",
                        width:80,
                        unresize: "true",
                        align: "center",
                    }, {
                      field: "sup_code",
                      title: "供编",
                      width:80,
                      unresize: "true",
                      align: "center",
                    }, {
                      field: "sup_color",
                      title: "供色",
                      width:80,
                      unresize: "true",
                      align: "center",
                   
                    }, {
                       field: "exp_method",
                       title: "提货方式",
                       width:100,
                       unresize: "true",
                       align: "center",
                    }, {
                        field: "exp_name",
                        title: "物流",
                        width:80,
                        unresize: "true",
                        align: "center"
                   }
                ]
            ]
        	
            table.render({
            	elem: '#dataTable',
            	url: MODULE_PATH+'recycle',
            	where:{},
            	page: true,
            	cols: cols,
            	cellMinWidth: 100,
            	even: true,
            	limit: 30,
            	toolbar: '#toolbar',
            	defaultToolbar: [{
            		title: '刷新',
            		layEvent: 'refresh',
            		icon: 'layui-icon-refresh',
            	}, 'filter', 'print', 'exports'],
            	done:function(res,curr,count){
            		var now=0;
            		var tr="tr1";
        
            		var $wz=5;
                    
            		if(res.data!=undefined){
            			for (let i=0; i < res.data.length; i++) {
            				if(now==0){
            					now=res.data[i].pur_id;
            				}else if(now!=res.data[i].pur_id){
            					tr=tr=="tr1"?"tr2":"tr1";
            					now=res.data[i].pur_id;
            				}
            				$('[data-index='+i+']').addClass(tr);
            			};
            		}
            	}
            });
            
        	mycomm.tableTool('{$controller_title}',MODULE_PATH,table_name);
        	mycomm.tableToolBar('{$controller_title}',MODULE_PATH,table_name);
        	mycomm.search_table(table_name);;
        
        })
    </script>
	{$LOAD_STYLE.bottom|raw}
	</body>
</html>
